<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title><!DOCTYPE html>
        <html>
        <head>
            <meta charset="utf-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>H+ 后台主题UI框架 - 项目</title>
            <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
            <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">
            <link rel="shortcut icon" href="favicon.ico"> <link href="/bootstrap/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
            <link href="/bootstrap/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
            <link href="/bootstrap/css/animate.min.css" rel="stylesheet">
            <link href="/bootstrap/css/style.min862f.css?v=4.1.0" rel="stylesheet">

            <link href="/webuploader/css/webuploader.css" rel="stylesheet">
            <link href="/webuploader/css/style33.css" rel="stylesheet">




        </head>
        <style>
            img{width: 200px}
            span{color: #cc181b}
        </style>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInUp">
    <form action="{:url('Enterpriseloan/doadd')}" method="post" id="from">
        <div class="row text-center">
            <div class="col-sm-12 ">
                <div class="ibox-title">
                    <h1 > 添加企业信息</h1>
                </div>
            </div>
        </div>

        <ul id="myTab" class="nav nav-tabs">
            <li class="active"><a href="#home1" data-toggle="tab">基本信息</a></li>
            <li><a href="#home6   " data-toggle="tab">其他信息</a></li>
        </ul>
        <div id="myTabContent" class="tab-content">
            <div class="tab-pane fade in active" id="home1">
                <div>
                    <div class="hr-line-dashed"></div>
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="form-group  ">
                                <label class="col-sm-1 control-label"></label>
                                <label class="col-sm-2 control-label text-right">起始日期：</label>
                                <div class="col-sm-6">
                                    <div class="row">
                                        <div class="col-md-8">
                                            <input type="text" class="form-control datepicker required"  data-val="起始日期" name="company[company_name]" value=""  placeholder="">
                                            <span class="help-block m-b-none"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-6">
                            <div class="form-group  ">
                                <label class="col-sm-1 control-label"></label>
                                <label class="col-sm-2 control-label text-right">结束日期：</label>
                                <div class="col-sm-6">
                                    <div class="row">
                                        <div class="col-md-8">
                                            <input type="text" class="form-control datepicker required" data-val="结束日期" name="company[website]" value=""  placeholder="">
                                            <span class="help-block m-b-none"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="form-group  ">
                                <label class="col-sm-1 control-label"></label>
                                <label class="col-sm-2 control-label text-right">借款金额（元）：</label>
                                <div class="col-sm-6">
                                    <div class="row">
                                        <div class="col-md-8">
                                            <input type="text" class="form-control required"  data-val="借款金额" name="company[address]" value=""  placeholder="">
                                            <span class="help-block m-b-none"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-6">
                            <div class="form-group  ">
                                <label class="col-sm-1 control-label"></label>
                                <label class="col-sm-2 control-label text-right">借款期限（天）：</label>
                                <div class="col-sm-6">
                                    <div class="row">
                                        <div class="col-md-8">
                                            <input type="text" class="form-control required" data-val="借款期限"  name="company[organization_no]" value=""  placeholder="">
                                            <span class="help-block m-b-none"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="form-group  ">
                                <label class="col-sm-1 control-label"></label>
                                <label class="col-sm-2 control-label text-right">总收益率（%）：</label>
                                <div class="col-sm-8">
                                    <div class="row">
                                        <div class="col-md-4">
                                            <input type="text" class="form-control required" data-val="总收益率"  name="company[license_no]" value=""  placeholder="">
                                            <span class="help-block m-b-none"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                </div>
            </div>
            <div class="tab-pane fade in"  style="padding-top: 20px" id="home6">
                <div>
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="form-group  ">
                                <label class="col-sm-2 control-label text-right">电子材料</label>
                                <div class="col-sm-8">
                                    <div class="row">
                                        <div class="col-md-8">
                                            <div id="uploader-demo">
                                                <!--用来存放item-->
                                                <div id="fileList3" class="uploader-list"></div>
                                                <div class="uploads_file">选择文件</div>

                                            </div>
                                        </div>
                                    </div>
                                    <div class="row" id="upload_file">
                                        <div class="col-md-12">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row text-center">
            <div class="btn btn-info" id="submit"> 提交</div>
        </div>
    </form>
</div>
</body>





<script src="/bootstrap/js/jquery.min.js?v=2.1.4"></script>
<script src="/bootstrap/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/bootstrap/js/content.min.js?v=1.0.0"></script>



<script type="text/javascript" src="/bootstrap/date/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="/bootstrap/date/bootstrap-datetimepicker.zh-CN.js"></script>
<link rel="stylesheet" href="/bootstrap/date/bootstrap-datetimepicker.min.css">

<script class="resources library" src="/js/address/address.js"></script>

<script src="/webuploader/js/jquery.cookie.js"></script>
<script src="/webuploader/js/jquery.slimscroll.min.js"></script>
<script type="text/javascript" src="/webuploader/webuploader.js"></script>
<script>
    var opt0 = [" ",""]
    _init_area();
</script>
<script>

    $(document).ready(function(){
        $("#loading-example-btn").click(function(){
            history.go(0);
            //  btn=$(this);simpleLoad(btn,true);simpleLoad(btn,false)})});function simpleLoad(btn,state){if(state){btn.children().addClass("fa-spin");btn.contents().last().replaceWith(" Loading")}else{setTimeout(function(){btn.children().removeClass("fa-spin");btn.contents().last().replaceWith(" Refresh")},2000)}
        })});
    (function($){
        $.fn.datetimepicker.dates['zh-CN'] = {
            days: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
            daysShort: ['周日','周一','周二','周三','周四','周五','周六'],
            daysMin: ['日','一','二','三','四','五','六'],
            months: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'],
            monthsShort: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'],
            today: '今天',
            suffix: [],
            meridiem: [],
            weekStart: 1,
            format: 'yyyy-mm-dd'
        };
    }(jQuery));
    $(function() {
        //初始化日期插件
        $('.datepicker').datetimepicker({
            language:  'zh-CN',
            weekStart: 1,
            todayBtn:  1,
            autoclose: 1,
            todayHighlight: 1,
            startView: 2,
            minView: 2,
            forceParse: 0,
            pickerPosition:'buttom-right'//日期插件弹出的位置
        });
        function create(){
            uploader.addButton({
                id: '#filePicker',
                innerHTML: '上传'
            });
        }
        upload_file();
        //图片上传 只能选择jpg 且文件不能大于1M
        $('#myTab li:eq(0) a').tab('show');
        $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
            $(".uploads_image").text("");
            $(".uploads_image").text("添加图片");
            upload_image();
            $(".uploads_file").text("");
            $(".uploads_file").text("添加文件");
            upload_file();
        })
    });
    $("#submit").click(function () {
        $("#from .required").each(function () {
            if($(this).val()=="")
            {
                var id = $(this).parents(".tab-pane").attr("id");
                var num = id.substring('4')-1;
                alert($(this).data("val")+'请填写')
                $('#myTab li:eq('+num+') a').tab('show');
                $(this).focus();
                return false;
            }
        })
    })
    //tab-pane

    //验证身份证号码是否正确
    $(".card").change(function () {
        var card = jQuery(".card").val();
        if(card==''){
            alert('身份证号码不得为空');return;
        }
        if(isCardNo($.trim($('.card').val())) == false) {
            alert('身份证号码不合规')
            $(this).val();
            $('#identity').focus();
        }
    })
    function isCardNo(card) {
        var pattern = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
        return pattern.test(card);
    }
    //验证手机号
//    $(".phone").change(function () {
//        var phone = jQuery(".phone").val();
//        var flag = false;
//        var message = "";
//        var myreg = /^(((13[0-9]{1})|(14[0-9]{1})|(17[0]{1})|(15[0-3]{1})|(15[5-9]{1})|(18[0-9]{1}))+\d{8})$/;
//        if(phone.length !=11){
//            message = "请输入有效的手机号码！";
//        }else if(!myreg.test(phone)){
//            message = "请输入有效的手机号码！";
//        }else{
//            flag = true;
//        }
//        if(!flag){
//            jQuery(".phone").val('');
//            alert(message);
//        }else{
//        }
//        return flag;
//    })


    //文本框剩余字数提醒
    $("textarea").change(function () {
        var lengths = $(this).val().length;
        var surplus =255 -lengths;
        $(this).parent().find(".count").html(surplus);
    })
    //上传图片
    function upload_image() {
        var allMaxSize=1
        var uploader = WebUploader.create({
            // 选完文件后，是否自动上传。
            auto: true,
            // swf文件路径
            swf: '/webuploader/Uploader.swf',
            // 文件接收服务端。
            server:"{:url('Upload/uploadFile')}",
            // 选择文件的按钮。可选。
            // 内部根据当前运行是创建，可能是input元素，也可能是flash.
            pick: '.uploads_image',//html  class
            // 只允许选择图片文件。
            fileSingleSizeLimit:allMaxSize*1024*1024,//限制大小10M，单文件
            fileSizeLimit: allMaxSize*1024*1024*10,//限制大小10M，所有被选文件，超出选择不上
            accept: {
                title: 'Images',
                extensions: 'gif,jpg',
                /* mimeTypes: 'image/!*'*/
                mimeTypes: 'image/jpg,image/jpeg'   //修改这行
            },
            method: "post",

        }).on('uploadSuccess', function (file, result) {
            src = "{$upyun}";
            var uploaderId = '#rt_' + file.source.ruid;
            var url = result._raw;
            $(uploaderId).parents("#uploader-demo").find("input[type='hidden']").val(url);
            $(uploaderId).parents("#uploader-demo").find("img").attr('src',src+url);
        }).on('uploadBeforeSend', function (object, data, headers) {
            this.reset();
            headers['X-XSRF-TOKEN'] = $.cookie('XSRF-TOKEN');
        });
        uploader.on("error",function (type){
            if(type=='F_EXCEED_SIZE')
            {
                alert('文件过大上传失败')
            }
        });
    }
    //上传文件
    function upload_file() {
        var allMaxSize=1
        var uploader = WebUploader.create({
            // 选完文件后，是否自动上传。
            auto: true,
            // swf文件路径
            swf: '/webuploader/Uploader.swf',
            // 文件接收服务端。
            server:"{:url('Upload/uploadFile')}",
            // 选择文件的按钮。可选。
            // 内部根据当前运行是创建，可能是input元素，也可能是flash.
            pick: '.uploads_file',//html  class
            // 只允许选择图片文件。
            accept: {
                title: '只选择文件',
                extensions: 'txt,docx,xlsx',
                /* mimeTypes: 'image/!*'*/
                mimeTypes: 'text/plain,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'   //修改这行
            },
            method: "post",

        }).on('uploadSuccess', function (file, result) {

            var url = result._raw;
            var array = url.split("/");// 在每个逗号(,)处进行分解。
            var name = array[array.length-1];

            var html = "<div class='col-md-12'>"+name+"</div>"
            $("#upload_file").append(html);
        }).on('uploadBeforeSend', function (object, data, headers) {
            this.reset();
            headers['X-XSRF-TOKEN'] = $.cookie('XSRF-TOKEN');
        });
    }


</script>
<script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script></title>
</head>
<body>

</body>
</html>